package com.ruoyi.retirement.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.retirement.domain.RetirementCarousel;
import com.ruoyi.retirement.mapper.RetirementCarouselMapper;
import com.ruoyi.retirement.service.IRetirementCarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 轮播图配置Service业务层处理
 * 
 * @author 曹旭
 * @date 2025-09-03
 */
@Service
public class RetirementCarouselServiceImpl implements IRetirementCarouselService 
{
    @Autowired
    private RetirementCarouselMapper retirementCarouselMapper;

    /**
     * 查询轮播图配置
     * 
     * @param id 轮播图配置主键
     * @return 轮播图配置
     */
    @Override
    public RetirementCarousel selectRetirementCarouselById(Long id)
    {
        return retirementCarouselMapper.selectRetirementCarouselById(id);
    }

    /**
     * 查询轮播图配置列表
     * 
     * @param retirementCarousel 轮播图配置
     * @return 轮播图配置
     */
    @Override
    public List<RetirementCarousel> selectRetirementCarouselList(RetirementCarousel retirementCarousel)
    {
        return retirementCarouselMapper.selectRetirementCarouselList(retirementCarousel);
    }

    /**
     * 新增轮播图配置
     * 
     * @param retirementCarousel 轮播图配置
     * @return 结果
     */
    @Override
    public int insertRetirementCarousel(RetirementCarousel retirementCarousel)
    {
        retirementCarousel.setCreateTime(DateUtils.getNowDate());
        return retirementCarouselMapper.insertRetirementCarousel(retirementCarousel);
    }

    /**
     * 修改轮播图配置
     * 
     * @param retirementCarousel 轮播图配置
     * @return 结果
     */
    @Override
    public int updateRetirementCarousel(RetirementCarousel retirementCarousel)
    {
        retirementCarousel.setUpdateTime(DateUtils.getNowDate());
        return retirementCarouselMapper.updateRetirementCarousel(retirementCarousel);
    }

    /**
     * 批量删除轮播图配置
     * 
     * @param ids 需要删除的轮播图配置主键
     * @return 结果
     */
    @Override
    public int deleteRetirementCarouselByIds(Long[] ids)
    {
        return retirementCarouselMapper.deleteRetirementCarouselByIds(ids);
    }

    /**
     * 删除轮播图配置信息
     * 
     * @param id 轮播图配置主键
     * @return 结果
     */
    @Override
    public int deleteRetirementCarouselById(Long id)
    {
        return retirementCarouselMapper.deleteRetirementCarouselById(id);
    }
}
